import React, { useMemo, useState } from "react";

const UseMemoComponent = () => {
    const [count, setCount] = useState(0)
    const result = useMemo(() => count * 2, [count])
    return (
        <div>
            <h1>useMemo</h1>
            <p>{count}</p>
            <p>{result}</p>
            <button onClick={() => {setCount(count + 1)}}>计数</button>
        </div>
    )
}

export default UseMemoComponent